<template>
  <div class="container">
      <div class="title">协同科研创新基础支撑平台</div>
      <div class="loginForm">
          <div>
              <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  <el-form-item label="用户名" prop="account">
    <el-input v-model="ruleForm.account" autocomplete="off"></el-input>
  </el-form-item>
  <el-form-item label="密码" prop="password">
    <el-input type="password" v-model="ruleForm.password" autocomplete="off"></el-input>
  </el-form-item>
 <el-form-item>
      <el-checkbox label="记住密码" name="type"></el-checkbox>
 </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
    
  </el-form-item>
</el-form>
 </div>
    <div >
          <el-button class="registar" type='text'>注册账号</el-button>
    </div>
      </div>
      
  </div>
</template>

<script>
export default {
    name:'Login',
    data() {
      var checkAccount = (rule, value, callback) => {
        if (!value) {
          return callback(new Error('用户名不能为空'));
        }
        setTimeout(() => {
          if (!Number.isInteger(value)) {
            callback(new Error('请输入数字'));
          }  else {
              callback();
            }
        }, 1000);
      };
      var validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('密码不能为空'));
        } 
          callback();
        
      };
      return {
        ruleForm: {
            account:'',
          password: '',
        },
        rules: {
          password: [
            { validator: validatePass, trigger: 'blur' }
          ],
          account: [
            { validator: checkAccount, trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>

<style scoped>
.title{
    position: relative;
    left: 136px;
    top: 128px;
    font-size: 72px;
    font-family:Georgia, 'Times New Roman', Times, serif;
    color: #fff;
}
.container{
    position: fixed;
    width: 100%;
    height: 100%;
    font-size: 20px;
    background-color: #1167D1;
}
.loginForm{
    padding-top: 50px;
    padding-left: 53px;
    margin: auto;
    width: 477px;
    height: 316px;
    font-size: 20px;
    position: absolute;
    left: 200px;
    top:336px;
    background-color: #f7f2f1;
}
.el-button{
    font-size: 20px;
    width: 252px;
    height: 51px;
}
.el-input{
    width: 252px;
    height: 49px;
}
.registar{
    width: 80px;
    height: 29px;
    font-size: 20px;
    color: black;
    margin-left: -19px;
    margin-top: -13px;  
}
.el-form /deep/.el-form-item__label,.el-form /deep/.el-checkbox__label{
    font-size: 20px;
}
</style>